import os
import xml.dom.minidom

def getTagLog():
        L = open('tags.log','w')
        T = open(os.getcwd() + '\\DUMMYPLUG_System\\DUMMYPLUG.xml','r')
        tree = xml.dom.minidom.parse(T)
        root = tree.documentElement
        tags = {}
        for x in root.getElementsByTagName('tag'):
        	text = x.getElementsByTagName('text')[0].firstChild.data
        	if text in tags.keys():
        		tags[text] += 1
        	else:
        		tags[text] = 1
        K = tags.keys()
        K.sort()
        for x in K:
        	L.write(x.encode('UTF-8','ignore') + ' :: ' + str(tags[x]) + '\n')
        L.close()
